﻿using UnityEngine;
using System.Collections;

namespace Lost{
	public enum InputEvent{
		Confirm, LeftConfirm, RightConfirm,
		Menu,
		Hold, Holding, Release
	}
	/// <summary>
	/// 迷失的输入接口
	/// </summary>
	public sealed class LostInput : MonoBehaviour {

		/// 获取玩家的移动方向
		public static Vector2 GetMoveDirection(){
			#if UNITY_EDITOR
			float h = Input.GetAxis("Horizontal");
			float v = Input.GetAxis("Vertival");
			return new Vector2(h,v);
			#endif
		}
		/// 获取某个输入事件是否被触发
		public static bool GetInputEvent(InputEvent inputEvent){
			switch (inputEvent) {
			case InputEvent.Confirm:
				return Input.GetMouseButtonDown (0);
				break;
			case InputEvent.LeftConfirm:
				break;
			case InputEvent.RightConfirm:
				break;
			case InputEvent.Menu:
				return Input.GetKeyDown (KeyCode.Tab);
				break;
			case InputEvent.Hold:
				return Input.GetMouseButtonDown (0);
				break;
			case InputEvent.Holding:
				return Input.GetMouseButton (0);
				break;
			case InputEvent.Release:
				return Input.GetMouseButtonUp (0);
				break;
			default:
				break;
			}
			return false;
		}
	}
}
